﻿{extends file='main.tpl'}
{block name='title'}
    Mon compte
{/block}
{block name='content'}
<div class="center"><a href="index.php?logout=true">(Déconnexion)</a></div>
{include file="informations_account.tpl"}
<a href="index.php?page=account_edit"><input type="button" name="modif" value="Modifier" class="btnRight"></a> <br />
<h1>Commandes</h1>
{foreach name=outer item=order from=$orders}
	<fieldset>
		<legend>Commande {$order.id}</legend>
		<table>
			{foreach name=outer item=shirt from=$order.shirts}
				<tr style="border: 1px solid gray;">
					<td><img id="shirt-img-{$shirt.id}" class="shirtThumb" src="img/shirts/{$shirt.id}-small.png" alt="shirt" /></td>
					<td><b>Reference:</b> {$shirt.ref} <br />
						<b>Marque:</b> {$shirt.brand} <br />
						<b>Description:</b> {$shirt.desc} <br />
						<b>Prix:</b> {$shirt.price} â‚¬<br />
					</td>
					<td>
						Quantité: <span id="quantity-{$shirt.id}">{$shirt.quantity}</span> <br />
						Prix: {$shirt.price} €<br />
						<b>QuantitÃ©:</b> <span id="quantity-{$shirt.id}">{$shirt.quantity}</span> <br />
						<b>Sexe:</b> {$shirt.sexe}<br />
					</td>
					<td>
						Total: <span class="subTotal" >{$shirt.total}</span> €
					</td>
				</tr>
			{/foreach}
			<th colspan="2"></th>
			<th>
				<b>Frais de port</b><br />
				<b>Réduction</b><br />
				<b>Total</b><br />
			</th>
			<th>
				<span id="fraisPort">{$order.fraisPort}</span>€<br />
				<span id="reduction">0</span>€<br />
				<b><span id="totalFinal">{$order.total}</span>€</b><br />
			</th>
		</table>
	</fieldset>
{/foreach}
{if $orders|@count eq 0}Vous n'avez effectué aucune commande.{/if}
<form method="post" action="index.php?page=account_deleted" >
	<input type="submit" name="deleteAccount" value="Supprimer mon compte" class="btnRight" />
</form>
{/block}
{block name='javascript'}
    <script type="text/javascript" src="pages/controller/js/store.js"></script>
    <script type="text/javascript">

	//JQuery main entry point
	$(document).ready(function() {
		{foreach name=outer item=order from=$orders}
			{foreach name=outer item=shirt from=$order.shirts}
					changeShirtColorAndSex({$shirt.id},'{$shirt.color}','{$shirt.sexe}');
			{/foreach}
		{/foreach}

		
		
	   updateTotalPrice();
	});
    </script>
{/block}